const Student = require("./student.js");
class Class{
    constructor(number){
        this.number=number
    }
    leader;
    teacher;
    appendMember(student){
        student.klass=this
        if (this.teacher) {
            this.teacher.notifyStudentAppended(student);
        }
    }
    assignLeader(student){
        if(student.klass==this) {
        this.leader=student
        if (this.teacher) {
            this.teacher.notifyLeaderAssigned(student);
        }
        }
        else
        console.log("It is not one of us.");
    }
    getDisplayName(){
        return `Class ${this.number}`
    }
    isIn(student){
        if(student.klass==this) 
        return true
        else
        return false
    }
    registerJoinListener(teacher){
        this.teacher=teacher
    }
    registerAssignLeaderListener(teacher){
        this.teacher=teacher
    }
}
module.exports = Class



